<template>
	<view style="background-color: white;">
		<view v-if="jifenRecord.length>0">
			<view class="order-box" v-for="(item,i) in jifenRecord" :key="item.index">
				<view class="box-b" style="height:55px;display:flex;">
					<image src="../../static/center/dianpu.png" style="height: 40px;width: 40px;margin-top: 12rpx;">
					<view class = "info">
						<view class="number">{{item.money}}积分</view> 
						<view class = "time">{{item.time}}</view> 
					</view> 
					<view class = "ways">
						<view style="margin-bottom:7px;margin-top: 3px;">消费</view>
						<view >{{item.name}}</view> 
					</view>
				</view>
				<view style="margin-top:5px;text-align:left;background-color:#edeef0;margin-right: 20rpx;">
					<view class="detail">{{item.detail}}</view>
				</view>
			</view>
		</view>
		<!-- <view v-show="jifenRecord.length<1" class="no-goods-box">
			<view>还没有流水记录</view>
		</view> -->
		<view class="tips-text">{{tips}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,			//页数
				size:10,		//条数
				jifenRecord:[], //积分流水集合
				tips:"上拉加载更多数据",
			}
		},
		onReachBottom() {
			if(this.tips=='上拉加载更多数据'){
				this.page++;
				this.getJifenRecord();
			}
		},
		onLoad() {
			this.$http.get('/jifen.do', {
				p:'historyxcx',
				userid:uni.getStorageSync('usersId')
			}).then(res => {
				if(res.data.length > 0){
					this.jifenRecord = res.data;
				}
			})
		},
		methods: {
			getJifenRecord(n){
				this.$http.get('/jifen.do', {
					page:this.page,
					size:this.size,
					p:'historyxcx',
					userid:uni.getStorageSync('usersId')
				}).then(res => {
					if(res.data.length>0){
						this.jifenRecord=this.jifenRecord.concat(res.data);
					}else{
						this.tips="没有更多数据";
					}
				})
			},
		}
	}
</script>

<style>
	.time,.ways,.detail{
		font-size: 14px;
		color: #909399;
	}
	.order-box{
		padding: 30rpx 0 60rpx 30rpx;
		border-bottom: 1px #d1d1d1 solid;
	}
	#houtai {
		background-image: url(${pageContext.request.contextPath}/weixin/img/center/dianpu.png);
	}
	.info {
		float: left;
		width: 160px;
		margin-left: 20px;
	}
	.number {
		font-size: 20px;
		color: #FF6700;
		margin-bottom: 5px;
	}
	.time {
		font-size: 14px;
	}
	.ways {
		float: left;
		margin-left: 20px;
	}
	.nav-header h1 {
		text-align: left;
	}
	.nav-header a {
		color: white;
	}
	.tips-text,.no-goods-box{
		text-align: center;
	}
</style>
